﻿using System;
using pheidippides.exceptionmanager.Forms;
using pheidippides.exceptionmanager.Interfaces;
using pheidippides.logging.Classes;

namespace pheidippides.exceptionmanager.Classes
{
    public class ExceptionManager : IExceptionManager
    {
        #region Singleton Kram

        private static IExceptionManager _staticIExceptionManager;

        public static IExceptionManager GetInstance()
        {
            if (_staticIExceptionManager == null)
                _staticIExceptionManager = new ExceptionManager();
            return _staticIExceptionManager;
        }

        #endregion

        public void RegisterException(String message, Exception ex)
        {
            ExceptionForm Frm = new ExceptionForm(message, ex, Logger.GetInstance().GetLastLogEntrysString());
            Frm.ShowDialog();
        }
    }
}